<!-- Start about -->
<a name="about"></a>
<section id="about">
    <div class="page-head">
        <div class="container">
            <div class="row">
                <div class="span9 head-text">
                    <h3><i class="icon-group"></i>About <span>JUSTERT</span></h3>
                    <?php
                    if (isset($short_about_us)):
                        echo "<p>{$short_about_us['Settings']['value']}</p>";
                    endif;
                    ?>
                </div>
                <div class="span3">
                    <i class="icon icon-group"></i>
                </div>
            </div>
        </div>			
    </div>
    <div class="container">
        <div class="page-section">
            <div class="row">
                <div class="span12">
                    <h4>Who we are ?</h4>
                    <?php echo (isset($about_us) ? '<p>' . $about_us['Cmspages']['content'] . '</p>' : 'No content here!'); ?>

                </div>				
            </div>
        </div>
    </div>
</section>
<!-- End about -->


<!-- Start Analyst -->
<section id="Analyst">
    <div class="page-head">
        <div class="container">
            <div class="row">
                <div class="span9 head-text">
                    <h3>List of <span>Analyst</span></h3>                    
                </div>
                <div class="span3">
                    <i class="icon icon-play-sign"></i>
                </div>						
            </div>
        </div>			
    </div>		
    <div class="container">
        <div class="page-section">
            <div class="row">
                <div class="span12 aligncenter">
                    <?php
                    foreach ($list_brokers as $broker):
                        $current_value = $previous_value = 0;
                        if ($broker['Stock']['values']) {
                            $current_value = $broker['Stock']['values'][0]['StockValues']['closing'];
                            if (isset($broker['Stock']['values'][1])) {
                                $previous_value = $broker['Stock']['values'][1]['StockValues']['closing'];
                            }

                            if ($current_value != $previous_value) {
                                ?>
                                <div class="services-box services-bgcolor e_bounce">                                    
                                    <h5><?php echo $broker['Broker']['fullname'] ?></h5>
                                    <h5 style="color: #e55237;"><?php echo $broker['Stock']['name'] ?></h5>
                                    <p>
                                        <?php echo 'Curent Value = ' . $current_value; ?><br>
                                        <?php echo 'On ' . date('d/m/Y', strtotime($broker['Stock']['values'][1]['StockValues']['date'])) . ' = ' . $previous_value; ?><br>
                                    </p>
                                    <p>
                                        Previous Difference<br>
                                        <i style="color:#0C3;">True</i>
                                    </p>
                                    <?php echo $this->Html->link('View Profile', '/analyst/view/' . $broker['Broker']['id'], array('class' => 'btn btn-primary')); ?>
                                </div>
                            <?php } else { ?>

                                <div class="services-box services-bg1 e_bounce">                                    
                                    <h5><?php echo $broker['Broker']['fullname'] ?></h5>
                                    <h5 style="color: #e55237;"><?php echo $broker['Stock']['name'] ?></h5>
                                    <p>
                                        <?php echo 'Curent Value = ' . $current_value; ?><br>
                                        <?php echo 'On ' . date('d/m/Y', strtotime($broker['Stock']['values'][1]['StockValues']['date'])) . ' = ' . $previous_value; ?><br>
                                    </p>
                                    <p>
                                        Previous Difference<br>
                                        <i style="color:#C33;">Wrong</i>
                                    </p>
                                    <?php echo $this->Html->link('View Profile', '/analyst/view/' . $broker['Broker']['id'], array('class' => 'btn btn-primary')); ?>
                                </div>

                                <?php
                            }
                        } else {
                            ?>
                            <div class="services-box services-bg1 e_bounce">                                
                                <h5><?php echo $broker['Broker']['fullname'] ?></h5>
                                <h5 style="color: #e55237;"><?php echo $broker['Stock']['name'] ?></h5>
                                <p>&nbsp;</p>
                                <?php echo $this->Html->link('View Profile', '/analyst/view/' . $broker['Broker']['id'], array('class' => 'btn btn-primary')); ?>
                            </div>

                        <?php }
                        ?>                        
                    <?php endforeach; ?>                    							
                </div>                
            </div>
        </div>
    </div>
</section>
<!-- End Analyst -->


<!-- Start Performer -->
<section id="Performer">
    <div class="page-head">
        <div class="container">
            <div class="row">
                <div class="span9 head-text">
                    <h3>List of <span>Performer</span></h3>                    
                </div>
                <div class="span3">
                    <i class="icon icon-user"></i>
                </div>						
            </div>
        </div>			
    </div>		
    <div class="container">
        <div class="page-section">
            <div class="row">
                <div class="span12 aligncenter">

                    <?php
                    foreach ($list_performer as $performer) {
                        $right = $wrong = 0;
                        if ($performer['Broker']['opinions']) {
                            $total_opinions = sizeof($performer['Broker']['opinions']);
                            $total_right = 0;
                            foreach ($performer['Broker']['opinions'] as $opinion) {
                                if ($opinion['Opinion']['result'] == 1) {
                                    $total_right++;
                                }
                            }

                            $right = number_format(($total_right / $total_opinions) * 100);
                            $wrong = 100 - $right;
                        }
                        ?>

                        <div class="services-box services-bg1 e_bounce">                        
                            <h5><?php echo $performer['Broker']['fullname']; ?></h5>
                            <p>
                                Performance <br><br>
                                <span id="green" style="display: block; width:<?Php echo "{$right}%"; ?>; background-color:#093;"><?php echo "{$right}%"; ?></span>
                                <span id="red" style="display: block; width:<?php echo "{$wrong}%"; ?>; background-color:rgba(204,51,0,1);"><?php echo "{$wrong}%"; ?></span>
                            </p>
                            <?php echo $this->Html->link('View Profile', '/analyst/view/' . $performer['Broker']['id'], array('class' => 'btn btn-primary')); ?>
                        </div>                        
                        <?php
                    }
                    ?>  							
                </div>
            </div>
        </div>
    </div>
</section>
<!-- End Performer -->

<!-- Start company -->
<section class="parallax parallax-bg3">
    <div class="main-pattern"></div>
    <div class="page-spacer">
        <div class="container">
            <div class="row margintop50">
                <div class="span12 aligncenter">						
                    <h3>List of company</h3>						
                </div>
                <div class="span12">
                    <ul id="mycarousel" class="jcarousel-skin-tango recent-post">
                        <?php foreach ($list_companies as $company): ?>
                            <li>
                                <div class="recent-post-box">
                                    <h6><?php echo $this->Html->link($company['Company']['name'], '/company/view/' . $company['Company']['id']); ?></h6>
                                    <p class="postdate"><span>Total Broker :</span> <?php echo $company['Company']['brokers'] ?></p>
                                    <p>
                                        <?php echo $company['Company']['short_description'] ?>
                                    </p>
                                    <?php echo $this->Html->link('View Profile', '/company/view/' . $company['Company']['id']); ?>
                                </div>
                            </li>

                        <?php endforeach; ?>                        								
                    </ul>
                </div>
            </div>
        </div>
    </div>			
</section>
<!-- End company -->



<!-- Start contact -->
<a name="contact"></a>
<section id="contact">
    <div class="page-head">
        <div class="container">
            <div class="row">
                <div class="span9 head-text">
                    <h3><i class="icon-envelope-alt"></i>Contact <span>us</span></h3>
                    <p>
                        <?php
                        if (isset($short_contact_us)):
                            echo "<p>{$short_contact_us['Settings']['value']}</p>";
                        endif;
                        ?>
                    </p>
                </div>
                <div class="span3">
                    <i class="icon icon-envelope-alt"></i>
                </div>							
            </div>
        </div>			
    </div>	
    <div class="container">
        <div class="page-section">
            <div class="row">
                <div class="span5">
                    <div class="contact-form-wrapper">
                        <div class="contact-form">
                            <h4>Quick contact</h4>
                            <form id="contactform" action="" method="post" class="validateform" name="leaveContact">
                                <div id="sendmessage">Your message has been sent. Thank you!</div>								
                                <ul class="listForm">
                                    <li>
                                        <label>Your name<span>&#40; Required &#41;</span></label>
                                        <input class="input-block-level contact-input" type="text" name="name" data-rule="maxlen:4" data-msg="Please enter at least 4 chars" />									
                                        <div class="validation"></div>
                                    </li>
                                    <li>
                                        <label>Your email<span>&#40; Required &#41;</span></label>
                                        <input class="input-block-level contact-input" type="text" name="email" data-rule="email" data-msg="Please enter a valid email" />										
                                        <div class="validation"></div>
                                    </li>
                                    <li>
                                        <label>Your message<span>&#40; Required &#41;</span></label>
                                        <textarea class="input-block-level contact-input" rows="9" name="message" data-rule="required" data-msg="Please write something for us"></textarea>												
                                        <div class="validation"></div>
                                    </li>
                                    <li>
                                        <input type="submit" value="Send message" class="btn btn-large btn-primary" name="Submit" />
                                    </li>
                                </ul>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="span7">
                    <?php echo (isset($map) ? $map['Settings']['value'] : ''); ?>
                    <h4>Contact detail</h4>
                    <?php
                    if (isset($contact_detail)):
                        echo "<p>{$contact_detail['Settings']['value']}</p>";
                    endif;
                    ?>							
                </div>
            </div>
        </div>
    </div>	
</section>
<!-- End contacct -->

